package com.zac.coroutine.algorithm.leetcode.strings

/**
 * author zac
 * date 2025/8/7
 *
 */
object CanConstruct {
    @JvmStatic
    fun main(args: Array<String>) {
        print(canConstruct("aa", "aavvb"))
    }

    fun canConstruct(ransomNote: String, magazine: String): Boolean {
        val arr = magazine.toCharArray()
        outer@ for (i in 0 until ransomNote.length) {
            val curChar = ransomNote[i]
            inner@ for (j in 0 until magazine.length) {
                if (arr[j] == curChar) {
                    arr[j] = '0'
                    continue@outer
                }
            }
           return false
        }
        return true
    }


}